﻿using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Web.Http;

namespace PirateMap
{
  public static class WebApiConfig
  {
    public static void Register(HttpConfiguration config)
    {
      config.Routes.MapHttpRoute(
          name: "DefaultApi",
          routeTemplate: "api/{controller}/{id}",
          defaults: new { id = RouteParameter.Optional }
      );

      MediaTypeFormatter jsonFormatter = config.Formatters.JsonFormatter;
      jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json"));

      config.Formatters.Clear();
      config.Formatters.Add(jsonFormatter);

      config.Formatters.JsonFormatter.Indent = true;
    }
  }
}
